package com.shlh.saas.service.impl;

import com.shlh.saas.entity.BusinessPopups;
import com.shlh.saas.mapper.BusinessPopupsMapper;
import com.shlh.saas.service.BusinessPopupsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class BusinessPopupsServiceImpl implements BusinessPopupsService {

    @Resource
    private BusinessPopupsMapper businessPopupsMapper;

    @Override
    public BusinessPopups getPopups(Long status, String lang) {
        BusinessPopups businessPopups = businessPopupsMapper.selectPopups(status);
        if (Objects.equals(lang, "en")){
            businessPopups.setPopupTitle(businessPopups.getPopupTitleEn());
            businessPopups.setPopupContent(businessPopups.getPopupContentEn());
            businessPopups.setPopupContentTitle(businessPopups.getPopupContentTitleEn());
        }
        return businessPopups;
    }
}
